const {
    Mysql
} = require('../../tools');

module.exports = async ctx => {
    try {
        let {
            name
        } = ctx.query;
        let sql = `SELECT config FROM config WHERE name = '${name}'`;
        let res = await Mysql(sql);
        if (res.length) {
            ctx.state.data = {
                code: '001',
                data: res[0].config
            }
        } else {
            ctx.state.data = {
                code: '001',
                data: JSON.stringify([])
            }
        }
    } catch (error) {

    }
}